using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlTypes;
using System.Data.Sql;
using System.Diagnostics;
using System.Data.SqlClient;

namespace AdatbazisProjekt
{
    public struct Termek
    {
        public string TermekNev;
        public string Kategoria;
        public string Gyarto;
        public int Ar;
        public int Garancia;
    }

    class DataTermekKereses : DalGen
    {
        public DataTermekKereses(ref bool Err)
        {
            if (!base.IsConnectCreated())
            {
                Err = !base.MakeConnection();
            }
        }

        public List<Termek> GetTermekInf()
        {
            OpenConnection();
            List<Termek> termek = new List<Termek>();

            Termek seged;

            string error = "";
            //SqlDataReader reader = mExecuteReader("SELECT TermekNev, KategoriaNev, GyartoNev, Ar, Garancia FROM Termekek, Gyartok, Kategoriak, Raktar WHERE Termekek.TermekID = Raktar.TermekID AND Termekek.KategoriaID = Kategoriak.KategoriaID AND Termekek.GyartoID = Gyartok.GyartoID", ref error);
            SqlDataReader reader = mExecuteReader("SELECT TermekNev FROM Termekek", ref error);
            while (reader.Read())
            {
                //auto.Add(reader["Rendszam"].ToString());
                seged.TermekNev = reader["TermekNev"].ToString();
                seged.Kategoria = reader["KategoriaNev"].ToString();
                seged.Gyarto = reader["GyartoNev"].ToString();
                seged.Ar = Convert.ToInt32(reader["Ar"].ToString());
                seged.Garancia = Convert.ToInt32(reader["Garancia"].ToString());

                termek.Add(seged);
            }

            return termek;
        }



    }
}
